from django.db import models
from django.core import validators

# Create your models here.
#
class Add(models.Model):
    username = models.CharField(max_length=10)
    password = models.CharField(max_length=10)

    def __str__(self):
        return "%d%s%s" %(self.pk,self.username,self.password)

class user(models.Model):


    name = models.CharField(max_length=99, default='')#姓名
    sex = models.BooleanField(null=True)  # 性别
    age = models.CharField(max_length=99, validators=[validators.RegexValidator('^\d+$', '年龄出现非数字字符')],
                               default='')  # 年龄
    money = models.CharField(max_length=100000)
    tel =models.CharField(max_length=11,validators=[validators.RegexValidator('^1[345678]\d{9}$')])
    photo = models.FileField(upload_to='images',null=True)
    # this_add = models.OneToOneField(Add,on_delete=)


class Women(models.Model):
    w_name = models.CharField(max_length=12)
    w_age = models.IntegerField()
    w_money = models.CharField(max_length=10)
    w_love = models.CharField(max_length=20)

    def __str__(self):
        return "%d%s%f%s%s" % (self.pk, self.w_name, self.w_age, self.w_money, self.w_love)





